package listbyorder.access301_400.test387;

public class Solution1 {

    // 第一个不一样的字符
    // 先走一个暴力解法
    public int firstUniqChar(String s) {
        char[] chars = s.toCharArray();
        int len = chars.length;
        boolean[] flag = new boolean[len];
        for (int i = 0; i < len; i++) {
            if (flag[i]) continue;
            char c = chars[i];
            for (int j = i + 1; j < len; j++) {
                if (chars[j] == c) {
                    flag[i] = true;
                    flag[j] = true;
                }
            }
            if (!flag[i]) {
                return i;
            }
        }
        return -1;
    }

}
